package com.example.bankend.vo;

import com.example.bankend.entity.User;
import lombok.Data;

import java.math.BigInteger;

/**
 * @author luolinila
 * @date 2025/6/17 18:47
 */
@Data
public class UserResult {
    private Long customerID;
    private String customerName;
    private String PID;
    private String telephone;
    private String address;

    public UserResult(User user) {
        this.customerID = user.getCustomerID();

        StringBuffer name = new StringBuffer(user.getCustomerName());
        for (int i = 1; i < name.length(); i++) {
            name.setCharAt(i, '*');
        }
        this.customerName = name.toString();

        StringBuffer PID = new StringBuffer(user.getPID());
        for (int i = 2; i < PID.length() - 4; i++) {
            PID.setCharAt(i, '*');
        }
        this.PID = PID.toString();

        StringBuffer phone = new StringBuffer(user.getTelephone());
        for (int i = 0; i < phone.length() - 4; i++) {
            phone.setCharAt(i, '*');
        }
        this.telephone = phone.toString();

        this.address = user.getAddress();
    }
}
